<?php /* Smarty version 2.6.16, created on 2008-07-03 14:55:21
         compiled from admin/tabs/setup/index.tmpl */ ?>
<script type="text/javascript" src="/js/jQuery/upload/ajaxfileupload.js"></script>
<script>
	function ajaxFileUpload()
    {
        //starting setting some animation when the ajax starts and completes
        $("#loading")
        .ajaxStart(function(){
            $(this).show();
        })
        .ajaxComplete(function(){
            $(this).hide();
        });
        
        /*
            prepareing ajax file upload
            url: the url of script file handling the uploaded files
                        fileElementId: the file type of input element id and it will be the index of  $_FILES Array()
            dataType: it support json, xml
            secureuri:use secure protocol
            success: call back function when the ajax complete
            error: callback function when the ajax failed
            
                */
        $.ajaxFileUpload
        (
            {
                url:'/upload/img', 
                secureuri:false,
                fileElementId:'fileToUpload',
                dataType: 'json',
                success: function (data, status)
                {
                    if(typeof(data.error) != 'undefined')
                    {
                        if(data.error != '')
                        {
                            alert(data.error);
                        }else
                        {
							var image = document.getElementById('image');
							var iv = document.getElementById('image-value');
							//alert(image);
							
							image.src = data.msg;
							iv.value = data.msg;
//                            alert(data.msg);
                        }
                    }
                },
                error: function (data, status, e)
                {
                    alert(e);
                }
            }
        )
        
        return false;

    } 

</script>
</script>
<img id="loading" src="/css/admin/images/progress_indicator.gif" style="display:none;">
<table cellpadding="0" cellspacing="0" class="tableForm">
		<thead>
			<tr>
				<th>Картинка:</th>
			</tr>
		</thead>
		<tbody>	
			<tr>
				<td><img src="<?php echo $this->_tpl_vars['site']->image; ?>
" id="image"></td>	
			</tr>
			<tr>
				<td><input id="fileToUpload" type="file" size="45" name="fileToUpload" onchange="return ajaxFileUpload();"></td>	

			</tr>
			<tr>
				<td>выберите картинку</td>
			</tr>
		</tbody>
</table>
<br />
<form action="/admin/system/setup" method="post">
	<input type="hidden" name="image" value="<?php echo $this->_tpl_vars['site']->image; ?>
" id="image-value">
	<input type="hidden" name="save" value="2">
	<b>Текст слогана:</b><br />
	<textarea  name="slogan_text"><?php echo $this->_tpl_vars['site']->slogan; ?>
</textarea><br />
	<input type="submit" value="сохранить">
</form>
